<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户扩展列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <p>昵称：</p>
                            <input type="text" name="nickname"/>
                        </li>

                        <li>
                            <p>职业：</p>
                            <input type="text" name="profession"/>
                        </li>
                        <li>
                            <p>居住地：</p>
                            <input type="text" name="address"/>
                        </li>
                        <li>
                            <p>是否是vip</p>
                            <select name="isvip">
                                <option value="">所有</option>
                                <option th:value="0">否</option>
                                <option th:value="1">是</option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:member:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:member:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
           <!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:member:remove">
                <i class="fa fa-remove"></i> 删除
            </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:member:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:member:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:member:remove')}]];
    var prefix = ctx + "app/member";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            editUserStatus: prefix + "/edit",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            normalUserStatus: prefix + "/edit",
            modalName: "用户",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'nickname',
                    title: '昵称',
                    formatter: function (value, row, index) {
                        if (value != null && value != '') {
                            if (value.length > 5) {
                                return value.substring(0, 5) + '...';
                            }
                            return value;
                        }
                    }
                },
                {
                    field: 'sex',
                    title: '性别'
                },
                {
                    field: 'headUrl',
                    title: '头像',
                    formatter: function (value, row, index) {
                        if (value == null || value == '') {
                            return "无";
                        }
                        return $.table.imageView(value, '/profile/avatar');
                    }
                },
                {
                    field: 'birthday',
                    title: '生日'
                },
                {
                    field: 'stature',
                    title: '身高'
                },
                {
                    field: 'weight',
                    title: '体重'
                },
                {
                    field: 'signature',
                    title: '签名',
                    formatter: function (value, row, index) {
                        if (value != null && value != '') {
                            if (value.length>=3)
                            return value.substring(0,3)+"...";
                        }else {
                            return  value
                        }
                    }
                },
                {
                    field: 'constellation',
                    title: '星座'
                },
                {
                    field: 'profession',
                    title: '职业'
                },
                {
                    field: 'invitationCode',
                    title: '邀请码'
                },
                {
                    field: 'emotionStatus',
                    title: '情感状态 '
                },
                {
                    field: 'address',
                    title: '居住地'
                },
                {
                    field: 'balance',
                    title: '余额'
                },
                {
                    field: 'earnings',
                    title: '收益'
                },
                {
                    field: 'treasure',
                    title: '财富值'
                },
                {
                    field: 'treasureLevel',
                    title: '财富等级'
                },
                {
                    field: 'isvip',
                    title: '是否开通过会员',
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "否"
                        } else {
                            return "是"
                        }
                    }
                },
                {
                    field: 'vipOpenTime',
                    title: 'vip开通时间'
                },
                {
                    field: 'vipCloseTime',
                    title: 'vip失效时间'
                },
                {
                    field: 'createTime',
                    title: '用户注册时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="chongzhi(\'' + row.id + '\')"><i class="fa fa-edit"></i>充值</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        if(row.status==1){
                            actions.push('<a class="btn btn-danger btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editUserStatus(\'' + row.id + '\')"><i class="fa fa-edit"></i>封停</a> ');
                        }
                        if (row.status==0){
                            actions.push('<a class="btn btn-danger btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.normalUserStatus(\'' + row.id + '\')"><i class="fa fa-edit"></i>解封</a> ');
                        }
                        /*actions.push('<a class="btn btn-danger btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editUserStatus(\'' + row.id + '\')"><i class="fa fa-edit"></i>封停</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.normalUserStatus(\'' + row.id + '\')"><i class="fa fa-edit"></i>解封</a> ');*/
                        /*actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');*/
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function chongzhi(id) {
        $.modal.open("充值", "http://byr.byrsns.com/app/rechargerecord/add2/"+id);
    }

</script>
</body>
</html>